package com.example.mall.domain;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.example.mall.util.CodeGenerateUtils;

import java.io.Serializable;

/**
 * <p>
 * 商品库存表
 * </p>
 *
 * @author whale
 * @since 2025-05-09
 */
@TableName("tb_product_inventory")
public class ProductInventory extends Model<ProductInventory> {

    private static final long serialVersionUID = 1L;

    /**
     * 库存唯一标识
     */
    @TableId("inventory_id")
    private Long inventoryId;
    /**
     * 商品ID（关联商品表）
     */
    @TableField("product_id")
    private Long productId;
    /**
     * 规格ID（关联规格表，如果支持多规格）
     */
    @TableField("spec_id")
    private Long specId;
    /**
     * 当前库存数量
     */
    private Integer stock;
    /**
     * 已锁定库存数量
     */
    @TableField("reserved_stock")
    private Integer reservedStock;
    /**
     * 创建时间
     */
    @TableField("create_date")
    private Date createDate;
    /**
     * 更新时间
     */
    @TableField("update_date")
    private Date updateDate;

    public ProductInventory() {
        this.inventoryId = Long.valueOf(CodeGenerateUtils.generateUniqueId());
    }

    public Long getInventoryId() {
        return inventoryId;
    }

    public void setInventoryId(Long inventoryId) {
        this.inventoryId = inventoryId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSpecId() {
        return specId;
    }

    public void setSpecId(Long specId) {
        this.specId = specId;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public Integer getReservedStock() {
        return reservedStock;
    }

    public void setReservedStock(Integer reservedStock) {
        this.reservedStock = reservedStock;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }


    @Override
    public String toString() {
        return "ProductInventory{" +
        ", inventoryId=" + inventoryId +
        ", productId=" + productId +
        ", specId=" + specId +
        ", stock=" + stock +
        ", reservedStock=" + reservedStock +
        ", createDate=" + createDate +
        ", updateDate=" + updateDate +
        "}";
    }
}
